package 代码记录.Bit48天集训;

import java.util.Scanner;

/**
 * 1.洗牌
 * 2.MP3光标位置
 * 堆排序的那个选择题关注一下
 * @author zx
 * @create 2022-05-17 19:34
 */
public class day_21 {
    /**
     * @param args 洗牌逻辑有误
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        for(int i = 0;i < T;i++){
            int n = sc.nextInt();
            int k = sc.nextInt();
            int[] arr = new int[2 * n];
            for(int j = 0;j < 2 * n;j++){
                arr[j] = sc.nextInt();
            }
            int[] res = xipai(arr,k);
            for(int j = 0;j < 2 * n;j++){
                System.out.print(res[j] + " ");
            }
            System.out.println();
        }

    }
    private static int[] xipai(int[] arr,int k){
        int n = arr.length / 2;
        int[] num = new int[2 * n];
        for(int a = arr.length - 1,b = n - 1,i = 0;a >= n && b >= 0 && i < 2 * n;a--,b--){
            num[i] = arr[a];
            i++;
            num[i] = arr[b];
            i++;
        }
        k--;
        if(k == 0){
            return xipai(num,k);
        }
        return num;
    }

    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        //%4
        int n = sc.nextInt();
        String str = sc.nextLine();
        if(n <= 4){

        }
    }
}
